/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa036.kiss.Entity;

/**
 *
 * @author Vasa
 */
public class VybaveniStudentaDTO {
    private Long id;
    private String nazev;
    private Double cena;
    private StudentDTO student;
    private PokojDTO pokoj;
    private KolejDTO kolej;
    private UbytovaniDTO ubytovani;

    public Long getId() {
        return id;
    }

    public VybaveniStudentaDTO setId ( final Long id ) {

    if ( id != null ) {

      this.id = new Long ( id.longValue () );
    }

    return this;
  }

    public String getNazev() {
        return nazev;
    }

    public void setNazev(String nazev) {
        this.nazev = nazev;
    }

    public Double getCena() {
        return cena;
    }

    public void setCena(Double cena) {
        this.cena = cena;
    }

    public StudentDTO getStudent() {
        return student;
    }

    public void setStudent(StudentDTO student) {
        this.student = student;
    }

    public PokojDTO getPokoj() {
        return pokoj;
    }

    public void setPokoj(PokojDTO pokoj) {
        this.pokoj = pokoj;
    }

    public KolejDTO getKolej() {
        return kolej;
    }

    public void setKolej(KolejDTO kolej) {
        this.kolej = kolej;
    }

    public UbytovaniDTO getUbytovani() {
        return ubytovani;
    }

    public void setUbytovani(UbytovaniDTO ubytovani) {
        this.ubytovani = ubytovani;
    }

    @Override
    public String toString() {
        return "VybaveniStudenta{" + "id=" + id + ", nazev=" + nazev + ", cena=" + cena + ", student=" + student + ", pokoj=" + pokoj + ", kolej=" + kolej + ", ubytovani=" + ubytovani + '}';
    }
    
     @Override
  public boolean equals ( final Object rhs ) {

    if ( this == rhs ) return true;

    if ( rhs == null ) return false;

    if ( this.getClass () != rhs.getClass () ) return false;

    VybaveniStudentaDTO c = (VybaveniStudentaDTO) rhs;

    return this.id == null ? c.id == null : this.id.equals ( c.id ) &&
        this.kolej == null ? c.kolej == null : this.kolej.equals ( c.kolej ) &&
        this.cena == null ? c.cena == null : this.cena.equals ( c.cena ) &&
        this.nazev == null ? c.nazev == null : this.nazev.equals ( c.nazev ) &&
        this.pokoj == null ? c.pokoj == null : this.pokoj.equals ( c.pokoj ) &&
        this.ubytovani == null ? c.ubytovani == null : this.ubytovani.equals ( c.ubytovani ) &&    
        this.student == null ? c.student == null : this.student.equals ( c.student );
  }

  @Override
  public int hashCode () {

    final int[] hashCodes = {
        (this.id == null) ? 0 : this.id.hashCode (),
        (this.kolej == null) ? 0 : this.kolej.hashCode (),
        (this.cena == null) ? 0 : this.cena.hashCode (),
        (this.nazev == null) ? 0 : this.nazev.hashCode (),
        (this.pokoj == null) ? 0 : this.pokoj.hashCode (),
        (this.ubytovani == null) ? 0 : this.ubytovani.hashCode (),
        (this.student == null) ? 0 : this.student.hashCode ()
    };

    int hash = 17;
    for ( final int currentHashCode: hashCodes ) {

      hash = hash * 31 + currentHashCode;
    }

    return hash;
  }
   @Override
   public Object clone () {

    try {

      return ( (VybaveniStudentaDTO) super.clone () ).setId ( this.id );
    } catch ( CloneNotSupportedException ex ) {

      assert false: "CloneNotSupportedException thrown";
      return null;
    }
  }
   public void checkState () {

    final boolean noNazev = this.nazev == null || this.nazev.isEmpty ();
    final boolean noCena = this.cena == null;

    if ( noNazev && noCena )  {

      throw new IllegalStateException ( "Nazev a cena musi byt nastaveny" );
    }
  }
}

